<?php
$item_name=$_GET["name"];
$ids=$_GET["ids"];
include("../includes/dbinfo.conf.php");
if(isset($item_name)){
$sql="SELECT * FROM item WHERE lower(name) like lower('%".$item_name."%')";
header("Content-type: application/json");
$result = mysql_query($sql);
$results = array();
while($row = mysql_fetch_array($result)){
   $results[] = array(
	  'id' => $row['id'],
      'name' => $row['name'],
      'description' => $row['description'],
      'specs' => $row['specs'],
      'image' => $row['image']
   );
}



}else if(isset($ids)){
$sql="SELECT * FROM item WHERE id in (".$ids.")";
header("Content-type: application/json");
$result = mysql_query($sql);
$results = array();
while($row = mysql_fetch_array($result)){
   $results[] = array(
		'id' => $row['id'],
      'name' => $row['name'],
      'description' => $row['description'],
      'specs' => $row['specs'],
	   'image' => $row['image']
   );
}
}
$json = json_encode($results);
$callback = $_GET['callback'];
echo $callback.' (' . $json . ');'; 

?> 